<div class="admin">
<div class="tab panel dux-box admin-panel">
    <div class="panel-head"><strong>友情连接</strong></div>
    <div class="padding border-bottom">
        <a href="" class="button button-small border-green">管理</a>
        <a href="JavaScript:void(0);" class="button button-small border-green">新增</a>
    </div>
    <div class="fixed-empty"></div>
    <form id="link_form" enctype="{:U('add')}" method="post">
        <table class="table tb-type2 nobdb">
            <tbody>
            <tr>
                <td class="required"><label class="validation" for="link_title">连接名称:</label></td>
                <td class="vatop rowform"><input type="text" value="" name="link_title" id="link_title" class="input input_big"></td>
                <td class="vatop tips">合作伙伴的名称</td>
            </tr>
            <tr>
                <td class="required"><label class="validation" for="link_url">连接地址:</label></td>
                <td class="vatop rowform"><input type="text" value="http://" name="link_url" id="link_url" class="input input_big"></td>
                <td class="vatop tips">合作伙伴的链接地址</td>
            </tr>
            <tr>
                <td class="required"><label for="link_pic">连接图片:</label></td>
                <td class="vatop rowform"><span class="type-file-box"><input type="file" name="link_pic" id="link_pic" class="type-file-file" size="30" ></span>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="ncm-upload-btn">
                        <!-- 图片上传按钮 -->
                        <a class="button input-file bg-blue" href="javascript:void(0);">+ 浏览文件
                        <input class="fileupload" type="file" name="image" data-name="link_pic" data-num="1">
                        </a>
                        <!-- 图片展示模块 -->
                        <div class="files">
                            <if condition="$res['link_pic']">
                                <div class="images_zone"><input type="hidden" name="link_pic" value="{$res['link_pic']}">
                                    <span><img src="{$v['link_pic']}!100x100"></span>
                                    <a href="javascript:;" style="display: none;">删除</a>
                                </div>
                            </if>
                        </div>
                        <div style="clear:both;"></div>
                        <!-- 图片上传进度条模块 -->
                        <div class="up_progress"><div class="progress-bar"></div></div>
                    </div>
                </td>
            </tr>
            <tr>
                <td class="required"><label for="link_sort">排序:</label></td>
                <td class="vatop rowform"><input type="text" value="4" name="link_sort" id="link_sort" class="input input_big"></td>
                <td class="vatop tips">数字越小越靠前</td>
            </tr>
            </tbody>
            <tfoot>
            <tr class="tfoot">
                <td colspan="3"><input type="submit" value="提交"/></td>
            </tr>
            </tfoot>
        </table>
    </form>
</div>
</div>
<script>
    //按钮先执行验证再提交表单
    $(function(){$("#submitBtn").click(function(){
        if($("#link_form").valid()){
            $("#link_form").submit();
        }
    });
    });
    //
    $(document).ready(function(){
        $('#link_form').validate({
            errorPlacement: function(error, element){
                error.appendTo(element.parent().parent().prev().find('td:first'));
            },
            success: function(label){
                label.addClass('valid');
            },
            rules : {
                link_title : {
                    required : true
                },
                link_url  : {
                    required : true,
                    url      : true
                },
                link_sort : {
                    number   : true
                }
            },
            messages : {
                link_title : {
                    required : ''
                },
                link_url  : {
                    required : '',
                    url      : ''
                },
                link_sort  : {
                    number   : ''
                }
            }
        });
    });
</script>
<!--F 上传图片-->
<script type="text/javascript" src="__JS__/jquery.uploads.js"></script>
<!--F 上传图片-->